package shortcode

import (
	"MyWeb/internal/pkg/snowflake"
)

// NewSnowURL 返回一个通过雪花算法生成的一个短链接的对象
func NewSnowURL() *SnowShortURL {
	return &SnowShortURL{}
}

type SnowShortURL struct{}

func (s *SnowShortURL) CreateShortCode() string {
	UniqueID, err := snowflake.GetID()
	if err != nil {
		return ""
	}
	ShortURL := GenerateShortUrl(UniqueID)
	return ShortURL
}
